package com.yan.network;

import java.io.IOException;

import org.apache.http.HttpEntity;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.params.HttpParams;


public class HttpConnector {
	
	private static final String USER_AGENT 	= "User-Agent";
	private static final int TIMEOUT = 30000;
	public static final int LOW_SOCKET_TIMEOUT = 3000;
	public static final int MEDIUM_SOCKET_TIMEOUT = 6000;
	public static final int HIGH_SOCKET_TIMEOUT = 10000;
	private static HttpParams httpParams;
	private static String LOCATION = "location";
	private static String HttpResponse = null;
	

	public final static HttpResponse getHttpResponse (HttpRequestBase request) throws ClientProtocolException, IOException{
		DefaultHttpClient client = new DefaultHttpClient(httpParams);
		org.apache.http.HttpResponse response = client.execute(request);
		HttpEntity entity = response.getEntity();
		return new HttpResponse(response.getStatusLine().getStatusCode(), 
																	response.getAllHeaders(),
																	entity,
																	client);
	}

}
